home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 863 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.4 KB

  1. Path: engnews1.Eng.Sun.COM!taumet!clamage
  2. From: boukanov@hadron.fi.uib.no (Igor Boukanov)
  3. Newsgroups: comp.std.c++
  4. Subject: Why "typedef int (*pf)() throw(int)" ill-formed?
  5. Date: 26 Mar 1996 18:56:11 GMT
  6. Organization: Fysisk institutt, Universitetet i Bergen
  7. Approved: clamage@eng.sun.com (comp.std.c++)
  8. Message-ID: <4j9808$pg1@ugress.uib.no>
  9. NNTP-Posting-Host: taumet.eng.sun.com
  10. Keywords: C++, excaptions
  11. X-Nntp-Posting-Host: hadron.fi.uib.no
  12. X-Newsreader: TIN [version 1.2 PL2]
  13. Content-Length: 516
  14. X-Lines: 26
  15. Originator: clamage@taumet
  16.  
  17.    From September DWP,  15.4.1:
  18. ...
  19. An exception-specification shall  not appear in a typedef declaration.  
  20. [Example:
  21. ...
  22. typedef int (*pf)() throw(int);  // ill-formed
  23. --end example]
  24.  
  25.  
  26. So instead of 
  27. typedef int (*pa)(int) throw();
  28. typedef int (*pf)(pa) throw();
  29. pf array[10];
  30.  
  31. one have to write:
  32. int (*array[10])(int (*)(int) throw()) throw();
  33.  
  34. or
  35. #define pa(name) int (*(name))(int) throw()
  36. #define pb(name) int (*(name))(pa(arg)) throw()
  37. pb(array[10]);
  38.  
  39.  
  40. --
  41. Regards, Igor Boukanov (igor.boukanov@fi.uib.no).
  42.  
  43.  
  44. [ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
  45. [ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
  46. [ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
  47. [ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
  48. [ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
  49.